//
//  HZJBaseTableViewController.swift
//  HZJNavigationView
//
//  Created by HZJ on 2017/2/20.
//  Copyright © 2017年 HZJ. All rights reserved.
//

import UIKit
///于tableview方法尚未能完成(不用此法)
class HZJBaseTableViewController: UITableViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        title = "HZJBaseTableViewController"
        self.tableView.backgroundColor = UIColor.white
        self.tableView.addSubview(myNavigationBar)
        self.navigationController?.navigationBar.isHidden = true
        
        self.tableView.register(UITableViewCell.self, forCellReuseIdentifier: "reuseIdentifier")
        self.tableView.separatorStyle = .none
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    // MARK: - Table view data source

    override func numberOfSections(in tableView: UITableView) -> Int {
        // #warning Incomplete implementation, return the number of sections
        return 1
    }

    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        // #warning Incomplete implementation, return the number of rows
        return 3
    }

    
    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath)
        cell.backgroundColor = .random
        return cell
    }

    //MARK: - 懒加载导航栏按钮
    lazy var myNavigationBar:UINavigationBar = {
        let y = UIApplication.shared.statusBarFrame.size.height
        let f = self.navigationController!.navigationBar.frame
        let nav = HZJNavigationBar(frame: CGRect(x: f.minX, y: 0, width: f.width, height: f.height + y))
        return UINavigationBar()
    }()

}
